package global;

import java.sql.Connection;
import java.sql.SQLException;

import lib.persistence.MySqlConnector;

public class ConnectionManager {
	   private static ConnectionManager instance = null;
	   private Connection connection;
	   protected ConnectionManager() {
	      // Exists only to defeat instantiation.
	   }
	   public static ConnectionManager getInstance() {
	      if(instance == null) {
	         instance = new ConnectionManager();
	      }
	      return instance;
	   }
	   public Connection getConnection()
	   {
		   return connection;   
	   }
	   public void setConnection(Connection conn)
	   {
		   this.connection = conn;
	   }
		public void setConnection(MySqlConnector mySqlConnector) throws ClassNotFoundException, SQLException {
			setConnection(mySqlConnector.getConnection());
			
		}

}
